package com.dean.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName DataUtils
 * @Description数据工具类
 * @Author dean
 * @Date 2021/11/30 15:26
 */
public class DataUtils<T> {
    public List<List<T>> arrayToLList(T [] array){
        List<List<T>> lists= new ArrayList<List<T>>(array.length);
        for (T t : array) {
            List<T> list = new ArrayList<T>();
            list.add(t);
            lists.add(list);
        }
        return lists;
    }

    public List<T> arrayToList(T [] array){
        List<T> list = new ArrayList<T>(array.length);
        for (T t : array) {
            list.add(t);
        }
        return list;
    }

    public List<List<T>> arrayToList(T [][] array){
        List<List<T>> lists = new ArrayList<List<T>>(array.length);
        for (T [] ts : array) {
            lists.add(arrayToList(ts));
        }
        return lists;
    }
}
